<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport"
		content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<title></title>
	<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
</head>
<!--/meta 作为公共模版分离出去-->

<body>
	<article class="cl pd-20">
		<div class="row col-xs-12 col-sm-12 col-md-10 text-c">
			<img src="" alt="" id="imgname" style="max-width: 600px;">
		</div>
		<div class="row cl mt-20">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="button" id="button" onclick="layer_close()"
					value="&nbsp;&nbsp;确定&nbsp;&nbsp;">
				<input class="btn btn-danger radius ml-10" type="button" id="button" onclick="delPicture()"
					value="&nbsp;&nbsp;删除&nbsp;&nbsp;">
			</div>
		</div>
	</article>

	<!--_footer 作为公共模版分离出去-->
	<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
	<!--/_footer /作为公共模版分离出去-->

	<script type="text/javascript" src="../static/js/admin.js?123"></script>

	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript">
		var activepath = "";
		var imgname = "";
		var query = window.location.search.substring(1);
		var vars = query.split("&");
		for (var i = 0; i < vars.length; i++) {
			var pair = vars[i].split("=");
			if (pair[0] == "activepath") {
				activepath = pair[1];
			}
			if (pair[0] == "imgname") {
				imgname = pair[1];
			}
		}

		if (activepath == "") {
			activepath = "/uploads";
		}

		$("#imgname").attr("src", "/data" + activepath + "/" + imgname);

		function layer_close() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}
		/* 删除图片 */
		function delPicture() {
			$.ajax({
				type: 'post',
				url: '/ajax/file_manager/delete',
				data: {
					'activePath': activepath,
					'fileName': imgname
				},
				dataType: "json",
				beforeSend: function (request) {
					request.setRequestHeader("authStr", window.localStorage.getItem(
						"userId") + "-" + window.localStorage.getItem("token"));
				},
				success: function (data) {
					if (data.success == true) {
						layer.msg(data.msg, {
							icon: 1,
							time: 1000
						}, function () {
							window.parent.location.reload();
							var index = parent.layer.getFrameIndex(window.name);
							parent.layer.close(index);
						});
					} else {
						layer.msg(data.msg, {
							icon: 5,
							time: 1000
						});
						return false;
					}
				}
			});
		}
	</script>
	<!--/请在上方写此页面业务相关的脚本-->
</body>

</html>